home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Acorn RISC PD-CD 1
/
Acorn RISC PD-CD 1.iso
/
sillies
/
_splodge
/
cas
< prev
next >
Wrap
Text File
|
1993-11-25
|
4KB
|
79 lines
--- CELLULAR AUTOMATA ---
Imagine an grid of multicoloured squares stretching out in all directions
across an infinite plane, each square is in one of several states, the colour
of the square indicating its state. Somewhere in the distance the ticking of
an immense cosmic clock can be heard. Upon each tick of the clock
every square changes its colour, from your high vantage point you can
see colour changes sweep over vast areas, strange organic patterns emerge
and swirl around, where in other places chaotic regions grow gradually
eating up large areas.
O.K, so I've probably made it sound a bit more interesting than it
actually is, but much interest has been shown in Cellular Automata in
recent years, even to the extent of a HORIZON programme dedicated
to the possibility that a self-replicating life form is poised to burst forth
from one.
Though I consider this rather unlikely, CAs are still an interesting
area of mathematical study due to their irreducible nature (you can't really
predict what they'll do, you just have to run them and watch), and also
because many computer simulations of natural systems are based on CAs,
though quite complicated ones.
Basically a CA consists or a grid of cells, with any number of
dimensions, though here I'll confine the discussion to 2-Dimensional CAs
(flat grid on a plane).
The grid should extend infinitly in all directions, but on a computer
limitations of time and space require a rectangular area to be defined
which wraps in both directions, i.e. the top and bottom are connected
together and so are the left and right edges.
The squares on the grid are represented by individual pixels, and in
SPLODGE! there are 16 possible states, i.e. 16 possible colours for each
pixel.
At each tick of the 'cosmic clock' each pixel assumes a state defined
by the state of its 8 nieghbours. The rule that is used here is at the heart
of the CA. This is the rule used in SPLODGE! :
State of cell that is alive becomes = INT(sum DIV a) + g
State of cell that is dead becomes = INT(a DIV k1) + INT(b DIV k2)
Where an alive cell is one whose present state is greater than zero,
sum = the total of the states of the 8 nieghbours added together,
a = number of nieghbours who are alive (state > 0) + 1,
b = number of nieghbours who are dead (state = 0) + 1,
and g,k1,k2 are constants that you can change to affect the nature
of the CA
The essential point of the CA is that the same rule is applied to every
cell simultaneously.
The program is started off by filling the grid randomly with squares of
all states, from which order soon emerges when the program is run. It would
be interesting to be able to control the initial state of the grid, perhaps
by biasing the random state generation, or by having the option of a start
from a Sprite image that could be designed on !Paint. I may include these
options on a future version if there is any interest.
The speed of execution of the program is an important factor with CAs,
I have tried to get SPLODGE! to run as fast as I can, and I don't think I've
seen a program that does the same screen area any faster, but if you have one
I would very much like to see it, or know how it was written.
I would also like to hear from anyone who has an interest in CAs and
knows of any other good algorithms, or has written a program, or anything
really.
You can probably contact me this address :
John Hedley
15 Hill Rise
Trowell
Nottingham
NG9 3PE
This program is dedicated to a T.V. programme we have here in the
Midlands called 'Central Weekend'. I stole their arrows.